/*
 * @Description: 表单区lable
 * @Author: llixxm
 */
import React, { Component } from 'react';

const style = {
    container: {
        display: 'flex'
    },
    require: {
        color: 'red'
    },
    marginL6: {
        marginLeft: '6px'
    },
    empty: {}
}
class FormLabel extends Component {
    constructor(props) {
        super(props);
        this.state = {

        }
    }
    static defaultProps = {
        isRequire: false, //是否是必输项,默认不显示*
        labelname: '', //要显示的文字
        isSecond: false //是否是一行的第二个,第二个label可能需要边距
    };
    render() {
        let { isRequire, labelname, children, isSecond } = this.props
        return(
            <div style={style.container}>
                {isRequire ? <span style={style.require}>*</span> : ''}
                <label className='nc-theme-form-label-c' style={isSecond ? style.marginL6 : style.empty}>
                    {labelname}：
                </label>
                {children}
            </div>
        );
    }
}
export default FormLabel